package com.hexinfo.dmpro.admin.model;

import lombok.Data;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Date;
import java.util.Objects;
import java.util.Set;

/**
 * @ClassName User
 * @Describe
 * @Author ml.wang
 * @Date 2021-06-17
 */
@Data
public class User implements Serializable {

    private Long id;

    private Long avatarId;

    private String username;

    /** 用户昵称 */
    private String nickName;

    private UserAvatar userAvatar;

    private String email;

    private String phone;

    private Boolean enabled;

    private String password;

    private Timestamp createTime;

    private Date lastPasswordResetTime;

    private Set<Role> roles;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        User user = (User) o;
        return Objects.equals(id, user.id) &&
                Objects.equals(username, user.username);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, username);
    }
}
